home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-18 | 2.2 KB | 62 lines | [TEXT/MPS ] |
- # Macintosh Programmer’s Assistant
- # Copyright © 1986-1996 Apple Computer, Inc. All rights reserved.
- #
- # -- brain surgery provided by the MPW doctors, 1/12/95, 3/29/96
- #
- # ------------------------------- #
- # MPTA_MPWAccess
- # ------------------------------- #
- #
- # Put this file in the MPW Scripts folder.
- #
- # This MPW script allows you to access the Macintosh Programmer’s Assistant
- # Apple Event commands from the MPW shell. It depends upon the {MPTA_Location} and
- # {MPTA_AppName} variables being defined and the Info menu being added by the
- # UserStartup•MPTA script. It also depends upon the existence of the SendAE tool in
- # the MPW Tools folder.
- #
- # {1} = name of the Macintosh Programmer’s Assistant command to execute
- #
-
- set thisMPTA_AECommand "{1}"
-
- If ("{thisMPTA_AECommand}" != "LookupHomePage")
- unset thisSelectedTerm # initialize
- If "`Catenate "{Active}.§"`" == ""
- set exit 0
- find \[¬{wordset}]\Δ:Δ/[¬{wordset}]/ "{Active}" # select the current word
- if "{status}" ≠ 0
- if `position -l "{Active}"` == 1 # first word in file?
- find •:/[{wordset}]+/ "{Active}" # yes, select it
- else # else must be word at end of file
- find \[¬{wordset}]\Δ:∞ "{Active}" # select the current word
- end
- end
- end
- set thisSelectedTerm "`Catenate "{Active}.§"`" # remember the current selection
- end
-
- if ("{thisMPTA_AECommand}" == "GetTemplate")
- "{MPTA_Location}" -background
- else
- "{MPTA_Location}"
- end
-
- if "{thisMPTA_AECommand}" == "LookupMPW"
- # note that the following line appends "MPW" to the term, in order to distinguish the
- # MPW lookup from a toolbox lookup
- (SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}MPW") ≥ dev:null
- else if "{thisMPTA_AECommand}" == "Lookup"
- SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "{thisSelectedTerm}" ≥ dev:null
- else if "{thisMPTA_AECommand}" == "LookupHomePage"
- (SendAE -e "DanRREF " -t "{MPTA_AppName}" -----TEXT "MPA_Home") ≥ dev:null
- else if "{thisMPTA_AECommand}" == "GetTemplate"
- set exit 0
- set tmpl "`(SendAE -e "DanRTMPL" -t "{MPTA_AppName}" -dot -----TEXT "{thisSelectedTerm}") ≥ dev:null`"
- if "{tmpl}" != ""
- echo "{tmpl}" >"{Active}".§
- End
- else
- Alert "Macintosh Programmer’s Assistant error: ∂n∂n “unrecognized command”"
- end
-